

#define makeMenu(m,p)
<tr data-tt-id="F_#(m.id)" #if(p) data-tt-parent-id="F_#(p.id)" #end>
	<td><span #if(m.children.size()>0) class="folder" #else class="file" #end>#(m.name)</span></td>
	<td>#(m.sort)</td>
	<!--<td>
		<input type="checkbox" name="paperBase.if_start" onchange="changeIfShow('#(m.id)',this)" value="1" #if(m&&m.if_start=='1') checked #end ></td>-->
	<td>
		<a class="label label-table label-info" onclick="doPjax('#(ctx)/admin/paperbase/getEditPage?parentid=#(m.id)')" href="javascript:void(0);" >添加下级菜单</a>&nbsp;
		<a class="label label-table label-success" onclick="doPjax('#(ctx)/admin/paperbase/getEditPage?id=#(m.id)')" href="javascript:void(0);">编辑</a>&nbsp;
		#if(m.children.size()==0)
			<a class="label label-table label-danger" onclick="del('#(m.id)')" href="javascript:void(0);" >删除</a>
		#else
			<a class="label label-table label-purple" onclick="del1('#(m.id)')" href="javascript:void(0);" >删除所有</a>
		#end
	</td>
</tr>
#end
<style>
	.switchery{
		padding: 0px !important;
	}
</style>
<div id="page-content">
	<div class="col-sm-12 eq-box-sm">
		<div class="panel ">
			<div class="panel-body">
				<div class="bootstrap-table">
					<div class="fixed-table-toolbar">
						<div class="bars pull-left">
							<a id="add" class="btn btn-mint data-toolbar" onclick="doPjax('#(ctx)/admin/paperbase/getEditPage')" href="javascript:void(0);"><i class="demo-pli-add"></i> 添加</a>
						</div>
					</div>
					<div class="fixed-table-container" style="padding-bottom: 0px;">
						<div class="fixed-table-body">
							<table id="treetable" class="demo-add-niftycheck table table-hover table-striped">
								<thead>
								<tr>
									<th style="width: 250px;"><div class="th-inner">评价指标</div></th>
									<th style="width: 50px;"><div class="th-inner">排序</div></th>
									<!--<th style="width: 80px;"><div class="th-inner">是否启用</div></th>-->
									<th style="width: 220px;"><div class="th-inner">操作</div></th>
								</tr>
								</thead>
								<tbody>
								#for(m:menu)
									#@makeMenu(m,"")
									#if(m.children)
										#for(a:m.children)
											#@makeMenu(a,m)
											#if(a.children)
												#for(b:a.children)
													#@makeMenu(b,a)
													#if(b.children)
														#for(c:b.children)
														#@makeMenu(c,b)
														#end
													#end
												#end
											#end
										#end
									#end
								#end
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
	$("#treetable").treetable({
		expandable: true,
		clickableNodeNames:true,
		onInitialized:function () {
			var Tree = this;
			for(var i = 0; i<Tree.roots.length; i++){
				$("#treetable").treetable("expandNode", Tree.roots[i].id);
			}
		}
	});//树表格
	//删除
	function del(ids){
        pointLion.confimMsg("您是否要删除所选信息 ?<br/> 点击确认进行删除 , 点击取消取消该操作",null,function(){
            //执行删除
            var data = common_ajax.ajaxFunc("/admin/paperbase/delete",{"ids":ids}, "json", null);
            //删除结果
            if(data.success){
                pointLion.alertMsg(data.message,"success",null,function(){
                    doPjax(ctx+'/admin/paperbase/getListPage');//跳转到列表页
                });
            }else{
                pointLion.alertMsg(data.message,"success",null,null);
            }
        });
    };
    function del1(ids){
        pointLion.confimMsg("您是否要删除所选信息,<span style='color: red'>包括其所有子项</span> ?<br/> 点击确认进行删除 , 点击取消取消该操作",null,function(){
            //执行删除
            var data = common_ajax.ajaxFunc("/admin/paperbase/delete",{"ids":ids}, "json", null);
            //删除结果
            if(data.success){
                pointLion.alertMsg(data.message,"success",null,function(){
                    doPjax(ctx+'/admin/paperbase/getListPage');//跳转到列表页
                });
            }else{
                pointLion.alertMsg(data.message,"success",null,null);
            }
        });
    };
	//控制是否启用
	function changeIfShow(id,o){
		var ifstart = "";
		if($(o)[0].checked) {
			ifstart = "1";
		}else{
			ifstart = "0";
		}
		var data = common_ajax.ajaxFunc("/admin/paperbase/changeIfStart",{"id":id,"ifstart":ifstart}, "json", null);
		if(data.success){
			pointLion.alertMsg("保存成功！","success",null,null);
		}else{
			pointLion.alertMsg("保存失败！","danger",null,null);
		}
	}
	$(document).ready(function(){
		var ifStartBtnArr = $("input[name='paperBase.if_start']");
		$.each(ifStartBtnArr,function(i,d){
			new Switchery(d);//制做开关按钮
		})
	});
</script>





<!-- #for(m:menu)
    <tr data-tt-id="F_#(m.id)">
      <td><span class="folder">#(m.name)</span></td>
      <td>#(m.url)</td>
      <td>#(m.sort)</td>
      <td>#if(m.if_show=='1') 显示  #else 不显示  #end</td>
      <td>#(m.permission)</td>
      <td>
              <a class="label label-table label-info" onclick="doPjax('#(ctx)/admin/sys/menu/getEditPage?parentid=#(m.id)')" href="javascript:void(0);" >添加下级菜单</a>&nbsp;
            <a class="label label-table label-success" onclick="doPjax('#(ctx)/admin/sys/menu/getEditPage?id=#(m.id)')" href="javascript:void(0);">编辑</a>&nbsp;
            #if(!m.children)<a class="label label-table label-danger" onclick="del('#(m.id)')" href="javascript:void(0);" >删除</a>#end
      </td>
    </tr>
    #if(m.children)
        #for(c:m.children)
            <tr data-tt-id="F_#(c.id)" data-tt-parent-id="F_#(m.id)">
              <td><span class="file">#(c.name)</span></td>
              <td>#(c.url)</td>
              <td>#(c.sort)</td>
              <td>#if(c.if_show=='1') 显示  #else 不显示  #end</td>
              <td>#(c.permission)</td>
              <td>
                      <a class="label label-table label-info" onclick="doPjax('#(ctx)/admin/sys/menu/getEditPage?parentid=#(c.id)')" href="javascript:void(0);" >添加下级菜单</a>&nbsp;
                    <a class="label label-table label-success" onclick="doPjax('#(ctx)/admin/sys/menu/getEditPage?id=#(c.id)')" href="javascript:void(0);">编辑</a>&nbsp;
                    <a class="label label-table label-danger" onclick="del('#(c.id)')" href="javascript:void(0);" >删除</a>
              </td>
            </tr>
        #end
    #end
#end -->